package com.gameapplet.cash.controller;

import com.gameapplet.WxPay.controller.WxPayController;
import com.gameapplet.cash.model.Balance;
import com.gameapplet.cash.model.Bill;
import com.gameapplet.cash.service.Impl.BalanceServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.Map;

@Controller
@RequestMapping("/cash")
public class CashController {
    @Resource(name = "balanceService")
    BalanceServiceImpl balanceService;

    @Autowired
    WxPayController wxPayController;

    @RequestMapping("/charge")
    @ResponseBody
    public String charge(Bill bill, HttpServletRequest request){
        if("".equals(bill.getDealType())||bill.getDealType()!=null){
            Map map = wxPayController.wxPay(bill.getDealType(),bill.getOpenid(),bill.getSum().toString(),request);
            if (map!=null){
                if ("2".equals(bill.getDealType())){

                }
            }
        }
        return null;
    }

}
